home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROGS.ZIP / ADLLIST.ICN < prev    next >
Text File  |  1992-09-28  |  2KB  |  76 lines

  1. ############################################################################
  2. #
  3. #    File:     adllist.icn
  4. #
  5. #    Subject:  Program to list address list fields
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     December 30, 1991
  10. #
  11. ###########################################################################
  12. #
  13. #    This program lists entries in address lists. The options are:
  14. #
  15. #    -c    by country
  16. #    -n    by name
  17. #    -C    by city (U.S. only)
  18. #    -s    by state (U.S. only)
  19. #    -z    by ZIP code (U.S. only)
  20. #
  21. #     The default is -n.  If more than one option is specified, the
  22. #    order of dominance is -n -z -s -c -C.
  23. #
  24. ############################################################################
  25. #
  26. #  See also: address.doc, adlcheck.icn, adlcount.icn, adlfilter.icn, 
  27. #     adlsort,icn, labels.icn
  28. #
  29. #  Links: adlutils, options
  30. #
  31. ############################################################################
  32.  
  33. link adlutils, options
  34.  
  35. procedure main(args)
  36.    local item, item_lists, opts, list_method, get_item, add
  37.  
  38.    item_lists := table()
  39.  
  40.    list_method := "n"            # The default is sorting by name.
  41.    get_item := get_lastname
  42.  
  43.    opts := options(args,"cnszC")
  44.  
  45.    if \opts["C"] then {            # If more than one given, last applies.
  46.       list_method := "C"
  47.       get_item := get_city
  48.       }
  49.    if \opts["c"] then {            # If more than one given, last applies.
  50.       list_method := "c"
  51.       get_item := get_country
  52.       }
  53.    if \opts["s"] then {
  54.       list_method := "s"
  55.       get_item := get_state
  56.       }
  57.    if \opts["z"] then {
  58.       list_method := "z"
  59.       get_item := get_zipcode
  60.       }
  61.    if \opts["n"] then {
  62.       list_method := "n"
  63.       get_item := get_lastname
  64.       }
  65.  
  66.    case list_method of {
  67.       "s" | "z" | "C": while add := nextadd() do
  68.          write(get_item(add))
  69.       "c" : while add := nextadd() do
  70.          write(format_country(get_item(add)))
  71.       "n" : while add := nextadd() do
  72.          write(get_namepfx(add)," ",get_item(add))
  73.       }
  74.        
  75. end
  76.